import typescript from "@rollup/plugin-typescript";

const typescriptPlugins = typescript({
  compilerOptions: {
    allowSyntheticDefaultImports: true,
  },
  include: ["./src/app/**/*.ts"],
});

export default [
  {
    input: "src/app/index.ts",
    output: {
      file: "./app/app.cjs",
      format: "cjs",
    },
    external: ["electron", "node:path", "mysql2/promise"],
    plugins: [typescriptPlugins],
  },
  {
    input: "src/app/main.ts",
    output: {
      file: "./app/main.cjs",
      format: "cjs",
    },
    external: ["electron", "node:path", "mysql2/promise"],
    plugins: [typescriptPlugins],
  },
  {
    input: "src/app/preload.ts",
    output: {
      file: "./app/preload.cjs",
      format: "cjs",
    },
    external: ["electron"],
    plugins: [typescriptPlugins],
  },
];
